﻿using System;
using System.Collections.Generic;
using SinBiota.Model.Business.PersistenceServices.Interfaces;
using SinBiota.Model.Entities;
using SinBiota.Model.Persistence.Repositories.Interfaces;

namespace SinBiota.Model.Business.PersistenceServices.Implementation
{
    public class HabitatPersistenceServices : IHabitatPersistenceServices
    {
        private readonly IHabitatRepository _habitatRepository;

        public HabitatPersistenceServices(IHabitatRepository habitatRepository)
        {
            _habitatRepository = habitatRepository;
        }

        public Habitat FindById(int id)
        {
            return _habitatRepository.FindById(id);
        }

        public Habitat FindByName(string name)
        {
            return _habitatRepository.FindByName(name);
        }


        public IList<Habitat> FindAll()
        {
            return _habitatRepository.FindAll();
        }

        public void Delete(Habitat habitat)
        {
            _habitatRepository.Delete(habitat);
        }
        public void DeleteById(int id)
        {
            Delete(FindById(id));
        }

        public void Save(Habitat habitat)
        {
            _habitatRepository.Save(habitat);
        }

        public void Update(Habitat habitat)
        {
            _habitatRepository.Update(habitat);
        }

        public IList<Habitat> FindByNameLike(string name)
        {
           return _habitatRepository.FindByNameLike(name);
        }
    }
}